<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        
        var name = "window"
        var obj = {
            name:"obj",
            sayName:function(){
                console.log(this.name);
            }
        }
        // 2、对象的方法中，谁执行方法this指向谁
        obj.sayName()
        // bind可以改变函数运行的上下文的环境，bind函数传谁this指向谁
        var show = function(){
            console.log(this.name)
        }.bind(obj)
        show()
    </script>
</body>
</html>